Conditions | 6 |
Total Lines | 24 |
Code Lines | 21 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import type { |
||
41 | |||
42 | function templateLine<O extends string>(line: string) { |
||
43 | const templ = templateParser.exec(line)?.groups |
||
44 | |||
45 | if (!templ) { |
||
46 | if (line.includes('### <vars ')) |
||
47 | throw Error(`Fix RegExp! "${line}"`) |
||
48 | |||
49 | return false |
||
50 | } |
||
51 | |||
52 | const { |
||
53 | indentation, |
||
54 | options |
||
55 | } = templ |
||
56 | , opts = {indentation} as {indentation: string} & Partial<Record<O, string>> |
||
57 | |||
58 | let kv: undefined|{"key": keyof typeof opts, "value": string} |
||
59 | |||
60 | while (kv = kvParser.exec(options)?.groups as typeof kv) |
||
61 | //@ts-expect-error |
||
62 | opts[kv.key as O] = kv.value |
||
63 | |||
64 | return opts |
||
65 | } |
||
81 |